package com.wwfish.cmsui.modules.content.client;

import com.nexustar.gwt.dashboard.client.MenuBuilder;
import com.nexustar.gwt.dashboard.client.MenuModel;
import com.nexustar.gwt.dashboard.client.PageModel;
import com.wwfish.cms.model.CMSConstants;
import com.wwfish.cmsui.modules.common.client.util.CodesHelper;
import com.wwfish.cmsui.modules.resource.client.ResourceManagePage;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Tom
 * Date: 2010-8-9
 * Time: 16:03:13
 * To change this template use File | Settings | File Templates.
 */
public class MenuImpl implements MenuBuilder {
    public List<MenuModel> getMenu() {
        MenuModel menu = new MenuModel("内容管理");
        menu.setIndex(1);
        menu.setPages(getPages());
        List result = new ArrayList();
        result.add(menu);
        return result;
    }

    private List getPages() {
        List r = new ArrayList();
        PageModel content = new PageModel();
        content.setPageTitle("内容管理");
        content.setPageId("NODE-nrgl");
        List children = new ArrayList();
        PageModel create = new PageModel();
        create.setPageId(ContentPage.class.getName());
        create.setPageTitle("内容创建");
        PageModel list = new PageModel();
        list.setPageId(ContentListPage.class.getName());
        list.setPageTitle("内容列表");
        children.add(create);
        children.add(list);
        content.setChildren(children);


        r.add(content);
        return r;
    }

    public void cacheModelData() {
        CodesHelper.cacheCodesById(CMSConstants._CODE_CONTENT_WORKFLOW_STATUS_ID);

    }
}